# Maintainer: Felix Yan <felixonmars@archlinux.org>

pkgname=golang-github-boombuler-barcode
pkgver=1.0.1
pkgrel=1
pkgdesc='A barcode creation lib for golang'
arch=('any')
url="https://github.com/boombuler/barcode"
license=('MIT')
depends=('go')
source=("$pkgname-$pkgver.tar.gz::https://github.com/boombuler/barcode/archive/v$pkgver.tar.gz")
sha512sums=('47bc74b2242f63afef836a664e456a7a0a7e4b65415640549a5e78504cef04c4393c26a9ce3afa165b609817ff94931e812481af0a0088110ca3c53dccd5cca7')

check() {
  export GO111MODULE=off
  export GOPATH="$srcdir/build:/usr/share/gocode"
  mkdir -p "$srcdir"/build/src/github.com/boombuler
  cp -a "$srcdir"/barcode-$pkgver "$srcdir"/build/src/github.com/boombuler/barcode
  cd "$srcdir"/build/src/github.com/boombuler/barcode
  go test -v $(go list ./...)
}

package() {
  mkdir -p "$pkgdir"/usr/share/gocode/src/github.com/boombuler
  cp -a "$srcdir"/barcode-$pkgver "$pkgdir"/usr/share/gocode/src/github.com/boombuler/barcode

  install -Dm644 barcode-$pkgver/LICENSE -t "$pkgdir"/usr/share/licenses/$pkgname/
}
